package com.zuosh.web;

import com.zuosh.dao.UserMapper;
import com.zuosh.domain.User;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;

/**
 * Created by zuoshuai on 2017/3/16.
 */
@RestController
@RequestMapping(value = "demo/test")
public class TestController {
    @Autowired
    private UserMapper userMapper;

    @GetMapping(value = "greet")
    public String greet() {
        return "hello";
    }

    @GetMapping(value = "getuser")
    public User testUser(HttpServletRequest request) {
        User user = new User();
        user.setUsername("feixueck");
        user.setPassword("feixue");
        user.setEmail("3@126.com");
        user.setAge(11);
        userMapper.insertSelective(user);
        return user;
    }

    @GetMapping(value = "test")
    public User tt(HttpServletRequest request) {
        return null;
    }
}
